package cn.edu.scau.cmi.ChenKaihui.simpleFactoryMethod;

import cn.edu.scau.cmi.ChenKaihui.domain.AccidentInsurance;
import cn.edu.scau.cmi.ChenKaihui.domain.CasualtyInsurance;
import cn.edu.scau.cmi.ChenKaihui.domain.Insurance;
import cn.edu.scau.cmi.ChenKaihui.domain.PhysicalInsurance;
import cn.edu.scau.cmi.ChenKaihui.domain.VehicleInsurance;

public class InsuranceFactory {
	
	public static Insurance getInstance(String insuranceTypeString) {
		Insurance insurance = null;
		switch (insuranceTypeString) {
		case "身体受伤": insurance = new PhysicalInsurance();
			break;
		case "汽车损坏": insurance = new VehicleInsurance();
		    break;
		case "人员伤亡": insurance = new CasualtyInsurance();
		    break;
		case "多种事故": insurance = new AccidentInsurance();
		    break;
		}
		
		return insurance;
		
	}

}
